# Maintainer: Jan de Groot <jgc@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - old version for v5 (rust required for 2.42+)

buildarch=2

pkgname=librsvg2.40
_pkgname=librsvg
pkgver=2.40.20
pkgrel=2
epoch=2
pkgdesc="SVG rendering library"
url="https://wiki.gnome.org/Projects/LibRsvg"
arch=(x86_64)
license=(LGPL)
depends=(gdk-pixbuf2 pango libcroco)
makedepends=(intltool gobject-introspection vala python2 gtk-doc git)
provides=(librsvg librsvg-${pkgver%%.*}.so)
_commit=2cbb0f7bf56666187993bd7ba688bf82d0c9a5c7  # tags/2.40.20^0
source=("git+https://git.gnome.org/browse/librsvg#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $_pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $_pkgname
  ./configure --prefix=/usr --disable-static --enable-vala --enable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' libtool
  make
}

check() {
  cd $_pkgname
  # Reftests fail due to differences in text rendering
  # Even with the fixated font on master there are still differences on i686
  make check || :
}

package() {
  cd $_pkgname
  make DESTDIR="$pkgdir" install
}
